package RedisDay2;

import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Redis_Hash {
    public static void main(String[] args) {
        Jedis master = new Jedis("192.168.111.166", 7000);
        master.select(5);
//        System.out.println(master.keys("*"));
        //建立数据
//        master.hset("age","小虎","120");
//        master.hset("age","小猫","130");
//        master.hset("age","小狗","140");
        //建立第二组
        HashMap<String, String> map = new HashMap<>();
        map.put("小龙","160");
        map.put("小猫","170");
        map.put("小云","180");
        master.hmset("age2",map);
//        Map<String, String> age = master.hgetAll("age");
//        System.out.println(age);
        Set<String> age = master.hkeys("age");
        System.out.println(age);
        List<String> age1 = master.hvals("age");
        System.out.println(age1);
        Set<String> age2 = master.hkeys("age2");
        System.out.println(age2);
        List<String> age21 = master.hvals("age2");
        System.out.println(age21);
    }
}
